<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>左中右plus</title>
	<link rel="stylesheet" href="../css/bootstrap.css">
	<style type="text/css">
	</style>
</head>
<body>
	<div class="container">
		<div class="row">
			<ul class="nav nav-tabs nav-justified tabs">
				<li class="active"><a href="#">Home</a></li>
				<li><a href="#">Profile</a></li>
				<li><a href="#">Message</a></li>
			</ul>
			<div class="home tabs-content">Home</div>
			<div class="profile tabs-content">Profile</div>
			<div class="message tabs-content">Message</div>
		</div>
		
	</div>
	<script src="../js/jquery-3.4.1.js" type="text/javascript"></script>
	<script src="../js/bootstrap.js"></script>
	<script type="text/javascript">
		function active(index) {
			$('.tabs>li').each(function(i, item) {
				if(i === index) {
					$(item).addClass('active')
				} else {
					$(item).removeClass('active')
				}
			})
			$('.tabs-content').each(function(i, item) {
				if(i === index) {
					$(item).show()
				} else {
					$(item).hide()
				}
			})
		}
		$(function() {
			let tabs = $('.tabs>li')
			tabs.each(function(i, item) {
				if($(item).hasClass('active')) {
					active(i)
					}
				})
			tabs.click(function() {
				active($(this).index())
				})
			})
	</script>
</body>
</html>
